import uuid

from django.db import models

from cars.models import Cars
from users.models import User
# Create your models here.

class Order(models.Model):
    model = models.CharField(max_length=20,verbose_name='品牌')
    cname = models.CharField(max_length=20,verbose_name='车名')
    img = models.ImageField(upload_to='static/models/',verbose_name='实物图')
    type  = models.CharField(max_length=20,verbose_name='车型')
    price = models.IntegerField(verbose_name='金额')
    firm = models.CharField(max_length=20,verbose_name='厂商')
    rank = models.CharField(max_length=20,verbose_name='级别')
    endurance = models.CharField(max_length=20,verbose_name='续航')
    charge = models.CharField(max_length=20,verbose_name='快充')
    order_uuid = models.UUIDField(verbose_name='UUID')
    order_number = models.CharField(max_length=50,verbose_name='单号')
    order_state = models.CharField(max_length=10,default='未支付',verbose_name='状态')
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    cars = models.ForeignKey(Cars, on_delete=models.CASCADE)

    def __str__(self):
        return self.order_number

    class Meta:
        verbose_name_plural = "订单"  # 复数形式